package WaiBao;

import java.util.Arrays;

public class LiYanLing {
    public static void main(String[] args) {
        String[] name = {"蓝心羽(班长)", "李晓雨(纪律委员)", "小李(学习委员)", "王希望(文艺委员)", "李少年", "王德芳", "贾磊", "张浩天", "欧阳春", "张小东", "张耀师", "沥青",
                "盲僧", "瞎子", "蛮王", "夏洛特", "剑姬", "血魔", "亚索", "小鱼人", "大嘴", "小炮", "寒冰", "射手", "孙尚香", "卢锡安", "奥巴马", "螳螂",
                "牧马人", "李炎林(学生)"};//考生本人: 李炎林(学生)
        int[] age = {20, 22, 20, 20, 18, 20, 20, 21, 19, 19, 21, 18, 19, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 18, 19};//最后一位：考生年龄:19


        double[] wulun1 = {87, 92, 81, 90, 79, 69, 78, 69, 84, 80, 91, 87, 85, 89, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 78, 95};
        double[] wulun2 = {74, 87, 93, 76, 78, 74, 77, 65, 70, 74, 75, 74, 66, 95, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 84, 65, 90, 95};
        double[] wulun3 = {86, 73, 84, 85, 77, 66, 78, 69, 88, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 77, 69, 95};



        double gushi1;//代表每个学生的总分
        double gushi2;//代表每个学生的平均分

//        for (int i = 0; i < name.length; i++) {
//            System.out.println("姓名:"+name[i]+" "+"年龄:"+age[i]);
//        }
//        for (int i = 0; i < 30; i++) {
//            gushi1 = wulun1[i] + wulun2[i] + wulun3[i];
//            gushi2 = (gushi1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + gushi1);
//            System.out.println(name[i] + "的平均分为:" + gushi2);
//        }


        double ta1 = 0,ta2 = 0;
        double[] Arr = new double[30];
//        for (int i = 0; i < 30; i++) {
//            ta1 = wulun1[i] +wulun2[i] +wulun3[i];
//            ta2 = (ta1 * 1.0) / 3;
//            Arr[i] = ta2;
//        }
//
//        for (int i = 0; i < Arr.length - 1; i++) {
//            for (int j = 0; j < Arr.length - i - 1; j++) {
//                if (Arr[j] < Arr[j + 1]) {
//                    double tep = Arr[j];
//                    Arr[j] = Arr[j + 1];
//                    Arr[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(Arr[i]);
//        }


        double peng1 = 0, peng2 = 0, peng3 = 0;//计算每门课的平均分
        double bobo1 = 0, bobo2 = 0, bobo3 = 0;//计算每门课标准差
        double book1 = 0, book2 = 0, book3 = 0;//计算每门课中位数
        double he = 0;
//        for (int i = 0; i <wulun1.length; i++) {
//            he +=wulun1[i];
//        }
//        peng1 = (he * 1.0) / 30;
//        System.out.println("生物化学的班级平均分为:" + peng1);
//        double Sum = 0;
//        for (int i = 0; i <wulun2.length; i++) {
//            Sum += wulun2[i];
//        }
//        peng2 = (Sum * 1.0) / 30;
//        System.out.println("物理化学的班级平均分为:" + peng2);
//        double sum = 0;
//        for (int i = 0; i < wulun3.length; i++) {
//            sum += wulun3[i];
//        }
//        peng3 = (sum * 1.0) / 30;
//        System.out.println("电子与电工技术的班级平均分为:" + peng3);
//
//
//        double c1 = 0, c2 = 0, c3 = 0;
//        for (int i = 0; i < wulun1.length; i++) {
//            c1 += (wulun1[i] - peng1) * (wulun1[i] - peng1);
//        }
//        bobo1 = Math.sqrt(c1*1.0/30);
//        System.out.println("生物化学的班级标准差为:" + bobo1);
//        for (int i = 0; i < wulun2.length; i++) {
//            c2 += (wulun2[i] -peng2) * (wulun2[i] - peng2);
//        }
//        bobo2 = Math.sqrt(c2*1.0/30);
//        System.out.println("物理化学的班级标准差为:" + bobo2);
//
//        for (int i = 0; i < wulun3.length; i++) {
//            c3 += (wulun3[i] -peng3) * (wulun3[i] -peng3);
//        }
//        bobo3 = Math.sqrt(c3*1.0/30);
//        System.out.println("电子与电工技术的班级标准差为:" +bobo3);
////
//
//
        Arrays.sort(wulun1);
        Arrays.sort(wulun2);
        Arrays.sort(wulun3);
        book1 = (wulun1[14] + wulun2[15]) * 1.0 / 2;
        book2 = (wulun2[14] + wulun2[15]) * 1.0 / 2;
        book3 = (wulun3[14] + wulun3[15]) * 1.0 / 2;
        System.out.println("生物化学的中位数为:" + book1);
        System.out.println("物理化学的中位数为:" + book2);
        System.out.println("电子与电工技术的中位数为:" + book3);





    }
}
